<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <body>
        <section class="content">
            <div class="item">元素</div>
            <div class="item">元素</div>
            <div class="item">元素</div>
            <div class="item">元素</div>
            <div class="item">元素</div>
            <div class="item">元素</div>
            <div class="item">元素</div>
        </section>
    </body>
    <style>
        .content {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
           
        }
        .item {
            flex: 0 0 calc((100% - 10px)/3);
            height: 120px;
            background-color: pink;
            
            margin: 0 5px 5px 0;
        }
        .item:nth-child(3n) {
        
            margin-right: 0;
        }
    </style>
       
        
</body>
</html>